#ifndef TSB_BASE_DOUBLE_BUFFER_QUEUE
#define TSB_BASE_DOUBLE_BUFFER_QUEUE
/*
* 
* @license	Apache License 2.0
* @author	Eugene Kuznetsov
*
*/
#include "Base.hpp"
#include <queue>

class CDoubleBufferQueue
{
public:
	CDoubleBufferQueue();
	~CDoubleBufferQueue();

	void PushToReceiveQueue(CDataBuffer* buffer);
	void PushToSendQueue(CDataBuffer* buffer);
	
	//void PickFirstFromReceiveQueue(CDataBuffer& buffer);
	//void PickFirstFromSendQueue(CDataBuffer& buffer);
	
	void PopFromReceiveQueue(CDataBuffer& buffer);
	void PopFromSendQueue(CDataBuffer& buffer);

	void setState(Base::eState state);
	Base::eState getState() const;

	UInt32 getReceiveQueueSize();
	UInt32 getSendQueueSize();

private:
	void* m_pReceiveCriticalSection;
	void* m_pSendCriticalSection;
	std::queue<CDataBuffer> m_qReceiveQueue;
	std::queue<CDataBuffer> m_qSendQueue;
	Base::eState m_eState;
};

#endif
